<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Actuator 监控页面</title>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <script type="text/javascript" th:src="@{/jquery/jquery-1.10.2.min.js}"></script>
    <script type="text/javascript" th:src="@{/json/formatJson.js}"></script>
    <style>
        #content div button {
            margin: 5px;
            height: 25px;
            width: auto;
            font-size: 14px;
            cursor: pointer;
        }

        #content div {
            text-align: center;
        }
        .panel-footer {
            padding: 10px 15px;
            background-color: #f5f5f5;
            border-top: 1px solid #ddd;
            border-bottom-right-radius: 3px;
            border-bottom-left-radius: 3px;
        }
    </style>
    <style>
    .Canvas {
        font: 10pt Georgia;
        background-color: #ECECEC;
        color: #000000;
        border: solid 1px #CECECE;
    }

    .ObjectBrace {
        color: #00AA00;
        font-weight: bold;
    }

    .ArrayBrace {
        color: #0033FF;
        font-weight: bold;
    }

    .PropertyName {
        color: #CC0000;
        font-weight: bold;
    }

    .String {
        color: #007777;
    }

    .Number {
        color: #AA00AA;
    }

    .Boolean {
        color: #0000FF;
    }

    .Function {
        color: #AA6633;
        text-decoration: italic;
    }

    .Null {
        color: #0000FF;
    }

    .Comma {
        color: #000000;
        font-weight: bold;
    }

    PRE.CodeContainer {
        margin-top: 0px;
        margin-bottom: 0px;
    }
    </style>

</head>
<body>

<div style="overflow: hidden">
    <div style="padding: 5px;margin: 10px;float: left;width: 30%;" id="content">
        <div>
            Actuator 端点
        </div>
        <div>
            <button onclick="showActuatorInfo('actuator')">actuator</button>
            <button onclick="showActuatorInfo('auditevents')">auditevents</button>
        </div>
        <div>
            <button onclick="showActuatorInfo('autoconfig')">autoconfig</button>
            <button onclick="showActuatorInfo('beans')">beans</button>
        </div>
        <div>
            <button onclick="showActuatorInfo('configprops')">configprops</button>
            <button onclick="showActuatorInfo('dump')">dump</button>
        </div>
        <div>
            <button onclick="showActuatorInfo('env')">env</button>
            <button onclick="showActuatorInfo('flyway')">flyway</button>
        </div>
        <div>
            <button onclick="showActuatorInfo('health')">health</button>
            <button onclick="showActuatorInfo('info')">info</button>
        </div>
        <div>
            <button onclick="showActuatorInfo('loggers')">loggers</button>
            <button onclick="showActuatorInfo('liquibase')">liquibase</button>
        </div>
        <div>
            <button onclick="showActuatorInfo('metrics')">metrics</button>
            <button onclick="showActuatorInfo('mappings')">mappings</button>
        </div>
        <div>
            <button onclick="showActuatorInfo('trace')">trace</button>
            <button style="background: red" onclick="showActuatorInfo('shutdown')">shutdown</button>
        </div>
    </div>
    <div class="panel-footer" id="Canvas" style="float: right;display: block;">
        <pre class="CodeContainer"><span class="String">""</span></pre>
    </div>
</div>


<script type="text/javascript" th:inline="javascript">
    var ctx = [[@{/}]];ctx = ctx.substr(0, ctx.length - 1);

    function showActuatorInfo(param) {
        if (param == 'shutdown') {
            if (confirm("shutdown 将会优雅的关闭该应用，请确认！")) {
                $.ajax({
                    type: "post",
                    url: ctx + "/actuatorMsg/" + param,
                    dataType: "text",
                    success: function (val) {
                        console.log(val);
                        Process(val);
                    },
                    error: function (e) {
                        badMood("获取 " + param + " 数据失败！");
                    }
                });
            }
        } else {
            $.ajax({
                type: "get",
                url: ctx + "/actuatorMsg/" + param,
                dataType: "text",
                success: function (val) {
                    console.log(val);
                    Process(val);
                },
                error: function (e) {
                    badMood("获取 " + param + " 数据失败！");
                }
            });
        }
    }
</script>

</body>
</html>

